/**
 * @see https://umijs.org/docs/max/access#access
 * */
export default function access(initialState: { currentUser?: API.CurrentUser } | undefined) {
  const {loginUser} = initialState ?? {};
  return {
    canUser: loginUser,
    // 如果loginUser存在，并且用户角色为 'admin',说明该用户是管理员
    canAdmin: loginUser && loginUser.userRole === "admin",
  };
}
